# -*- coding:utf-8 -*-

from fastapi import FastAPI
import uvicorn
import time
from starlette.requests import Request
from starlette.staticfiles import  StaticFiles
from starlette.templating import Jinja2Templates

app = FastAPI()

templates = Jinja2Templates(directory="test")
@app.get("/BOCVIP/pages/noticeMessage/user_content_message_list.html")
async def event_template_1(request: Request):
    return templates.TemplateResponse('user_content_message_list.html', {"request": request})


@app.get("/BOCGIFTNET/ajaxData/ajaxGetPicUrl.do")
async def event_template_2():
    my_dict = {"picRootPath": "https://jf365.boc.cn"}
    return my_dict


@app.get("/BOCGIFTNET/ajaxMember/ajaxNoticesData.do")
async def event_template_3():
    t3_dict = {"NoticesData": {"notices": [{"pnc_author": "yycz_lhx",
                                            "pnc_content": "尊敬的客户：\r\n    您好！    \r\n    为保障您积分账户的安全，自2021年1月1日起我行将新增月度积分兑换限制，具体规则如下：\r\n    每客户每月全渠道可兑换使用200万交易积分，同时原单礼品月度兑换限额、其他合作平台月度兑换限额及航空里程主动兑换年度30万里程兑换限制保持不变，航空里程自动兑换及年费兑换不在此限额内。\r\n    感谢您对“中银积分365”的关注和支持，我们将继续竭诚为您提供优质便捷的服务！ \r\n\r\n                                                             中国银行股份有限公司 \r\n                                                             二零二零年十一月五日",
                                            "pnc_expireDate": "20501231", "pnc_noticeID": "NT1000098056",
                                            "pnc_pubDate": "2020-11-05", "pnc_scope": "0", "pnc_stt": "0",
                                            "pnc_title": "关于信用卡交易积分增加月度兑换限制的公告"}, {"pnc_author": "admin",
                                                                                   "pnc_content": "尊敬的客户：您好！\r\n    \r\n    受新疆地区疫情及交通管控影响，快递/物流公司反馈：即日起，暂停新疆地区的快件揽派业务；恢复时间另行通知。您兑换的礼品可能会出现未发货、停滞在某处或延迟派件等情况；待物流恢复后，我行将第一时间按照订单兑换时间顺序发货；在途快递将根据交通管控情况分批送达，请您耐心等待。由此给您带来的不便，敬请谅解！                        \r\n    感谢您对“中银积分365”的关注和支持，我们将继续竭诚为您提供优质便捷的服务！\r\n                                                                  \r\n\r\n                              中国银行股份有限公司 \r\n                              二零二零年七月二十日",
                                                                                   "pnc_expireDate": "20501231",
                                                                                   "pnc_noticeID": "NT1000097056",
                                                                                   "pnc_pubDate": "2020-07-20",
                                                                                   "pnc_scope": "0", "pnc_stt": "0",
                                                                                   "pnc_title": "关于新疆地区物流延迟的公告"}]}}
    return t3_dict


@app.get("/BOCGIFTNET/ajaxData/ajaxSyncToken.do")
async def event_template_4():
    return "token@c5c9453a84f54fb48b704b94a114ae03"


@app.get("/BOCVIP/ajaxMember/ajaxAllNoticeListData.do")
async def event_template_5():
    t5_dict = {
        "data": {
            "children": [
                {
                    "pnc_scope": "0",
                    "pnc_moddate": "20210525112958",
                    "pnc_content": "",
                    "pnc_title": "关于部分积分即将于6月30日到期的公告",
                    "pnc_stt": "0",
                    "pnc_pubdate": "20210508",
                    "pnc_expiredate": "20551231",
                    "pnc_noticeID": "NT1000101056",
                    "pnc_author": "yycz_lhx"
                },
                {
                    "pnc_scope": "0",
                    "pnc_moddate": "20210106112012",
                    "pnc_content": "",
                    "pnc_title": "关于2021年春节前后积分兑换实物礼品物流停运/寄送延迟的公告",
                    "pnc_stt": "0",
                    "pnc_pubdate": "20210106",
                    "pnc_expiredate": "20501231",
                    "pnc_noticeID": "NT1000099056",
                    "pnc_author": "yycz_lhx"
                },
                {
                    "pnc_scope": "0",
                    "pnc_moddate": "20201104164541",
                    "pnc_content": "",
                    "pnc_title": "关于信用卡交易积分增加月度兑换限制的公告",
                    "pnc_stt": "0",
                    "pnc_pubdate": "20201105",
                    "pnc_expiredate": "20501231",
                    "pnc_noticeID": "NT1000098056",
                    "pnc_author": "yycz_lhx"
                },
                {
                    "pnc_scope": "0",
                    "pnc_moddate": "20201025094308",
                    "pnc_content": "",
                    "pnc_title": "关于新疆地区物流延迟的公告",
                    "pnc_stt": "0",
                    "pnc_pubdate": "20200720",
                    "pnc_expiredate": "20501231",
                    "pnc_noticeID": "NT1000097056",
                    "pnc_author": "admin"
                }
            ],
            "totalNum": 4,
            "totalPage": 1,
            "currentPage": 1
        }
    }
    return t5_dict


@app.get("/persistent_connection.do")
async def event_template_10000():
    return time.time()




if __name__ == "__main__":
    uvicorn.run("fast_template:app", host="0.0.0.0", port=5555)
